<template>
    <div class="admin-dashboard">
      <AdminNavbar />
      
      <div class="admin-container">
        <AdminSidebar />
        
        <main class="admin-main-content">
          <router-view></router-view>
        </main>
      </div>
    </div>
  </template>
  
  <script setup>
  import AdminNavbar from '@/components/admin/AdminNavbar.vue'
  import AdminSidebar from '@/components/admin/AdminSidebar.vue'
  import { useUserStore } from '@/store/user'
  import { onMounted } from 'vue'
  import { useRouter } from 'vue-router'
  
  const userStore = useUserStore()
  const router = useRouter()
  
  // 检查管理员权限
  onMounted(() => {
    if (!userStore.isLoggedIn || !userStore.isAdmin) {
      router.push('/admin/login')
    }
  })
  </script>
  
  <style scoped>
  .admin-dashboard {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f5f7fa;
  }
  
  .admin-container {
    display: flex;
    flex: 1;
  }
  
  .admin-main-content {
    flex: 1;
    padding: 20px;
    overflow: auto;
  }
  </style>